function check() {
    var user = form1.user.value;
    var password = form1.password.value;
    var imageCode = form1.imageCode.value;
    var userType = form1.userType.value;
    if (user == "") {
        alert("用户名不能为空！");
        form1.user.focus();
        return false;
    } else if (password == "") {
        alert("密码不能为空！");
        form1.password.focus();
        return false;
    } else if (imageCode != "uwv6") {
        alert("验证码错误！");
        form1.imageCode.focus();
        return false;
    } else if (imageCode == "") {
        alert("验证码不能为空！");
        form1.imageCode.focus();
        return false;
    } else {
        return true;
    }
}


function realSysTime(clock) {
    var now = new Date();			//创建Date对象
    var year = now.getFullYear();	//获取年份
    var month = now.getMonth();	//获取月份
    var date = now.getDate();		//获取日期
    var day = now.getDay();		//获取星期
    var hour = now.getHours();	//获取小时
    var minu = now.getMinutes();	//获取分钟
    var sec = now.getSeconds();	//获取秒钟
    month = month + 1;
    var arr_week = new Array("Sun", "Mon", "Tus", "Wed", "Thu", "Fri", "Sat");
    var week = arr_week[day];		//获取中文的星期
    var time = year + "/" + month + "/" + date + "/ " + week + " " + hour + ":" + minu + ":" + sec;	//组合系统时间
    clock.innerHTML = time;	//显示系统时间
}

window.onload = function () {
    window.setInterval("realSysTime(clock)", 1000);	//实时获取并显示系统时间
}


function checkUsername(){
    var username= form1.user;
    var usernameInfo = document.getElementById("usernameInfo");
    if(username.value == "") {
        usernameInfo.innerHTML="请输入用户名";
        usernameInfo.display = "block";
        username.focus();
        return false;
    } else {
        usernameInfo.innerHTML = "";
        usernameInfo.display = "none";
        return true;
    }
}

function checkPassword(){
    var password= form1.password;
    var passwordInfo = document.getElementById("passwordInfo");
    if(password.value == "") {
        passwordInfo.innerHTML="请输入密码";
        passwordInfo.display = "block";
        password.focus();
        return false;
    } else {
        passwordInfo.innerHTML = "";
        passwordInfo.display = "none";
        return true;
    }
}

function checkImageCode(){
    var imageCode= form1.imageCode;
    var imageCodeInfo = document.getElementById("imageCodeInfo");
    if(imageCode.value == "") {
        imageCodeInfo.innerHTML="请输入验证码";
        imageCodeInfo.display = "block";
        imageCode.focus();
        return false;
    } else if (imageCode.value !="uwv6"){
        imageCodeInfo.innerHTML = "验证码错误";
        imageCodeInfo.display = "block";
        imageCode.focus();
        return false;
    }else {
        imageCodeInfo.innerHTML = "";
        imageCodeInfo.display = "none";
        return true;
    }
}

function checkLogin(){
    if(checkUsername() && checkPassword() && checkImageCode())
        return true;
    return false;
}
